API reference
- Overview
- API parameters
- Insights API
- Recommend API
- Search API
- Search operations
- Records operations
- Indices operations
- Synonyms operations
- API keys operations
- Rules operations
- Dictionaries operations
- Clusters operations
- Vaults operations
- Advanced operations
Rules operations
Retrieve a rule
Retrieves a rule by its ID.
To find the object ID of rules, use the search
operation.
GET
/
1
/
indexes
/
{indexName}
/
rules
/
{objectID}
Copy
Ask AI
// Initialize the client
var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));
// Call the API
var response = await client.GetRuleAsync("<YOUR_INDEX_NAME>", "qr-1725004648916");
// >LOG
Copy
Ask AI
{
"objectID": "<string>",
"conditions": [
{
"pattern": "{facet:genre}",
"anchoring": "is",
"alternatives": false,
"context": "mobile",
"filters": "genre:comedy"
}
],
"consequence": {
"params": {
"similarQuery": "comedy drama crime Macy Buscemi",
"filters": "(category:Book OR category:Ebook) AND _tags:published",
"facetFilters": [
[
"category:Book",
"category:-Movie"
],
"author:John Doe"
],
"optionalFilters": [
"category:Book",
"author:John Doe"
],
"numericFilters": [
[
"inStock = 1",
"deliveryDate < 1441755506"
],
"price < 1000"
],
"tagFilters": [
[
"Book",
"Movie"
],
"SciFi"
],
"sumOrFiltersScores": false,
"restrictSearchableAttributes": [
"title",
"author"
],
"facets": [
"*"
],
"facetingAfterDistinct": false,
"page": 0,
"offset": 123,
"length": 500,
"aroundLatLng": "40.71,-74.01",
"aroundLatLngViaIP": false,
"aroundRadius": 2,
"aroundPrecision": 123,
"minimumAroundRadius": 2,
"insideBoundingBox": "<string>",
"insidePolygon": [
[
47.3165,
4.9665,
47.3424,
5.0201,
47.32,
4.9
],
[
40.9234,
2.1185,
38.643,
1.9916,
39.2587,
2.0104
]
],
"naturalLanguages": [],
"ruleContexts": [
"mobile"
],
"personalizationImpact": 100,
"userToken": "test-user-123",
"getRankingInfo": false,
"synonyms": true,
"clickAnalytics": false,
"analytics": true,
"analyticsTags": [],
"percentileComputation": true,
"enableABTest": true,
"attributesToRetrieve": [
"author",
"title",
"content"
],
"ranking": [
"typo",
"geo",
"words",
"filters",
"proximity",
"attribute",
"exact",
"custom"
],
"customRanking": [
"desc(popularity)",
"asc(price)"
],
"relevancyStrictness": 90,
"attributesToHighlight": [
"author",
"title",
"conten",
"content"
],
"attributesToSnippet": [
"content:80",
"description"
],
"highlightPreTag": "<em>",
"highlightPostTag": "</em>",
"snippetEllipsisText": "…",
"restrictHighlightAndSnippetArrays": false,
"hitsPerPage": 20,
"minWordSizefor1Typo": 4,
"minWordSizefor2Typos": 8,
"typoTolerance": true,
"allowTyposOnNumericTokens": true,
"disableTypoToleranceOnAttributes": [
"sku"
],
"ignorePlurals": [
"ca",
"es"
],
"removeStopWords": [
"ca",
"es"
],
"keepDiacriticsOnCharacters": "øé",
"queryLanguages": [
"es"
],
"decompoundQuery": true,
"enableRules": true,
"enablePersonalization": false,
"queryType": "prefixLast",
"removeWordsIfNoResults": "firstWords",
"mode": "keywordSearch",
"semanticSearch": {
"eventSources": [
"<string>"
]
},
"advancedSyntax": false,
"optionalWords": "<string>",
"disableExactOnAttributes": [
"description"
],
"exactOnSingleWordQuery": "attribute",
"alternativesAsExact": [
"ignorePlurals",
"singleWordSynonym"
],
"advancedSyntaxFeatures": [
"exactPhrase",
"excludeWords"
],
"distinct": 1,
"replaceSynonymsInHighlight": false,
"minProximity": 1,
"responseFields": [
"*"
],
"maxValuesPerFacet": 100,
"sortFacetValuesBy": "count",
"attributeCriteriaComputedByMinProximity": false,
"renderingContent": {
"facetOrdering": {
"facets": {
"order": [
"<string>"
]
},
"values": {}
},
"redirect": {
"url": "<string>"
},
"widgets": {
"banners": [
{
"image": {
"urls": [
{
"url": "<string>"
}
],
"title": "<string>"
},
"link": {
"url": "<string>"
}
}
]
}
},
"enableReRanking": true,
"reRankingApplyFilter": [
"<any>"
],
"query": {
"remove": [
"<string>"
],
"edits": [
{
"type": "remove",
"delete": "<string>",
"insert": "<string>"
}
]
},
"automaticFacetFilters": [
{
"facet": "<string>",
"score": 123,
"disjunctive": true
}
],
"automaticOptionalFacetFilters": [
{
"facet": "<string>",
"score": 123,
"disjunctive": true
}
]
},
"promote": [
{
"objectIDs": [
"test-record-123"
],
"position": 0
}
],
"filterPromotes": false,
"hide": [
{
"objectID": "test-record-123"
}
],
"userData": "<any>"
},
"description": "Display a promotional banner",
"enabled": true,
"validity": [
{
"from": 123,
"until": 123
}
]
}
Authorizations
Your Algolia application ID.
Your Algolia API key with the necessary permissions to make the request. Permissions are controlled through access control lists (ACL) and access restrictions. The required ACL to make a request is listed in each endpoint's reference.
Path Parameters
Name of the index on which to perform the operation.
Example:
"ALGOLIA_INDEX_NAME"
Unique identifier of a rule object.
Response
200
application/json
OK
Rule object.
Was this page helpful?
Copy
Ask AI
// Initialize the client
var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));
// Call the API
var response = await client.GetRuleAsync("<YOUR_INDEX_NAME>", "qr-1725004648916");
// >LOG
Copy
Ask AI
{
"objectID": "<string>",
"conditions": [
{
"pattern": "{facet:genre}",
"anchoring": "is",
"alternatives": false,
"context": "mobile",
"filters": "genre:comedy"
}
],
"consequence": {
"params": {
"similarQuery": "comedy drama crime Macy Buscemi",
"filters": "(category:Book OR category:Ebook) AND _tags:published",
"facetFilters": [
[
"category:Book",
"category:-Movie"
],
"author:John Doe"
],
"optionalFilters": [
"category:Book",
"author:John Doe"
],
"numericFilters": [
[
"inStock = 1",
"deliveryDate < 1441755506"
],
"price < 1000"
],
"tagFilters": [
[
"Book",
"Movie"
],
"SciFi"
],
"sumOrFiltersScores": false,
"restrictSearchableAttributes": [
"title",
"author"
],
"facets": [
"*"
],
"facetingAfterDistinct": false,
"page": 0,
"offset": 123,
"length": 500,
"aroundLatLng": "40.71,-74.01",
"aroundLatLngViaIP": false,
"aroundRadius": 2,
"aroundPrecision": 123,
"minimumAroundRadius": 2,
"insideBoundingBox": "<string>",
"insidePolygon": [
[
47.3165,
4.9665,
47.3424,
5.0201,
47.32,
4.9
],
[
40.9234,
2.1185,
38.643,
1.9916,
39.2587,
2.0104
]
],
"naturalLanguages": [],
"ruleContexts": [
"mobile"
],
"personalizationImpact": 100,
"userToken": "test-user-123",
"getRankingInfo": false,
"synonyms": true,
"clickAnalytics": false,
"analytics": true,
"analyticsTags": [],
"percentileComputation": true,
"enableABTest": true,
"attributesToRetrieve": [
"author",
"title",
"content"
],
"ranking": [
"typo",
"geo",
"words",
"filters",
"proximity",
"attribute",
"exact",
"custom"
],
"customRanking": [
"desc(popularity)",
"asc(price)"
],
"relevancyStrictness": 90,
"attributesToHighlight": [
"author",
"title",
"conten",
"content"
],
"attributesToSnippet": [
"content:80",
"description"
],
"highlightPreTag": "<em>",
"highlightPostTag": "</em>",
"snippetEllipsisText": "…",
"restrictHighlightAndSnippetArrays": false,
"hitsPerPage": 20,
"minWordSizefor1Typo": 4,
"minWordSizefor2Typos": 8,
"typoTolerance": true,
"allowTyposOnNumericTokens": true,
"disableTypoToleranceOnAttributes": [
"sku"
],
"ignorePlurals": [
"ca",
"es"
],
"removeStopWords": [
"ca",
"es"
],
"keepDiacriticsOnCharacters": "øé",
"queryLanguages": [
"es"
],
"decompoundQuery": true,
"enableRules": true,
"enablePersonalization": false,
"queryType": "prefixLast",
"removeWordsIfNoResults": "firstWords",
"mode": "keywordSearch",
"semanticSearch": {
"eventSources": [
"<string>"
]
},
"advancedSyntax": false,
"optionalWords": "<string>",
"disableExactOnAttributes": [
"description"
],
"exactOnSingleWordQuery": "attribute",
"alternativesAsExact": [
"ignorePlurals",
"singleWordSynonym"
],
"advancedSyntaxFeatures": [
"exactPhrase",
"excludeWords"
],
"distinct": 1,
"replaceSynonymsInHighlight": false,
"minProximity": 1,
"responseFields": [
"*"
],
"maxValuesPerFacet": 100,
"sortFacetValuesBy": "count",
"attributeCriteriaComputedByMinProximity": false,
"renderingContent": {
"facetOrdering": {
"facets": {
"order": [
"<string>"
]
},
"values": {}
},
"redirect": {
"url": "<string>"
},
"widgets": {
"banners": [
{
"image": {
"urls": [
{
"url": "<string>"
}
],
"title": "<string>"
},
"link": {
"url": "<string>"
}
}
]
}
},
"enableReRanking": true,
"reRankingApplyFilter": [
"<any>"
],
"query": {
"remove": [
"<string>"
],
"edits": [
{
"type": "remove",
"delete": "<string>",
"insert": "<string>"
}
]
},
"automaticFacetFilters": [
{
"facet": "<string>",
"score": 123,
"disjunctive": true
}
],
"automaticOptionalFacetFilters": [
{
"facet": "<string>",
"score": 123,
"disjunctive": true
}
]
},
"promote": [
{
"objectIDs": [
"test-record-123"
],
"position": 0
}
],
"filterPromotes": false,
"hide": [
{
"objectID": "test-record-123"
}
],
"userData": "<any>"
},
"description": "Display a promotional banner",
"enabled": true,
"validity": [
{
"from": 123,
"until": 123
}
]
}
Assistant
Responses are generated using AI and may contain mistakes.